package com.example.Service.impl;

import com.example.Mapper.UsersMapper;
import com.example.Service.LoginService;
import com.example.Service.MenuService;
import com.example.entity.Users;

import cn.dev33.satoken.stp.StpUtil;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginImpl implements LoginService {
    @Autowired
    UsersMapper usersDao;
    @Override
    public Users login(Users users) {

        Users user = usersDao.findOneByUsername(users.getUserName());
        if(user!=null&& user.getUserPassword().equals(users.getUserPassword())){
            StpUtil.login(user.getUserId());
            return user;
        }else {
            return null;
        }
    }



}